<h3><?php echo $this->title?></h3>
<div class="upload-image">
<div style="color:red;" id="edit_message"><?php echo $this->errMessage;?></div>
<form action="/admin/course/list" method="get">
    <h4>Tìm kiếm khóa học</h4>
    <table class="table table-condensed">
        <tr>
            <td><label for="id">Id:</label></td>
            <td><input type="text" id="id" name="id" value="<?php echo $this->params['id'];?>" /></td>
        </tr>
        <tr>
            <td><label for="title">Tiêu đề:</label></td>
            <td><input id="title" name="title" value="<?php echo $this->params['title'];?>" /></td>
            <td><label for="active">Hiện trên web</label></td>
            <td>
                <select id="active" name="active">
                    <option value="0" <?php echo 0 == $this->params['active']?"selected='selected'":""?>>[Tất cả]</option>
                    <option value="1" <?php echo 1 == $this->params['active']?"selected='selected'":""?>>Có</option>
                    <option value="2" <?php echo 2 == $this->params['active']?"selected='selected'":""?>>Không</option>
                </select>
            </td>
        </tr>
    </table>
    <div class="control-group">
        <div class="controls">
          <button type="submit" class="btn">Tìm</button>
        </div>
  </div>
</form>
<a href="/admin/course/edit" style="font-weight: bold">Tạo mới</a>
<?php if(is_array($this->courses)) {?>
    <table class="table table-bordered table-striped">
        <thead>
              <tr>
                <th>Tiêu đề</th>
                <!-- th>Ảnh đại diện</th-->
                <th>Hiện trên web</th>
                <th>Order</th>
                <td>Khóa học cha</td>
                <td>Khai giảng</td>
                <td>Địa điểm</td>
                <td>Buổi học</td>
                <th>Ngày cập nhật</th>
                <th>Ngày tạo</th>
                <th>Thao tác</th>
              </tr>
        </thead>
        <tbody>
            <?php foreach($this->courses as $course) :?>
             <tr>
                 <td><b><?php echo $course['titles']['vi']['content']?></b><br/><a href="#course_title_popup_<?php echo $course['id']?>" data-toggle="modal" title="Xem thêm tiếng anh">Xem thêm</a></td>
                 <!-- td>
                     <a class="fancy" href="<?php echo Utils_Global::get('staticUrl') . '/course/' . $course['hash_folder'] . '/' . $course['image']?>">
                         <img alt="<?php echo $course['image']?>" src="<?php echo Utils_Global::get('staticUrl') . '/course/' . $course['hash_folder'] . '/' . $course['image']?>" width="100" height="100">
                     </a>
                 </td-->
                 <td>
                     <?php if($course['active']) {?>
                     <i class="icon-ok"></i>
                     <?php } else {?>
                     <i class="icon-lock"></i>
                     <?php }?>
                 </td>
                 <td>
                     <?php echo $course['order'];?>
                 </td>
                 <td>
                     <?php if($course['parent']) {?>
                         <a href="/admin/course/edit/id/<?php echo $course['parent'];?>">
                             view parent
                         </a>
                     <?php }?>
                 </td>
                 <td>
                     <?php echo date('d-m-Y', $course['start_time']);?>
                 </td>
                 <td>
                     <?php echo implode(",", json_decode($course['location'], true));?>
                 </td>
                 <td><?php echo $course['schedule_type']?></td>
                 <td>
                     <?php echo date('d-m-Y', $course['last_update']);?>
                 </td>
                 <td>
                     <?php echo date('d-m-Y', $course['dateline']);?>
                 </td>
                 <td>
                     <?php if(!$course['parent']) {?>
                     <a href="/admin/course/edit-tab/course_id/<?php echo $course['id'];?>">
                         Thêm tab
                     </a><br/>
                     <a href="/admin/course/list-tab/course_id/<?php echo $course['id'];?>">
                         Xem tab
                     </a>
                     <?php }?>
                     <a href="/admin/course/edit/id/<?php echo $course['id']?>">
                         <i class="icon-edit"></i>
                     </a>
                     <a href="/admin/course/delete/id/<?php echo $course['id']?>" onclick="return confirm('Thật sự muốn xóa?');">
                         <i class="icon-remove"></i>
                     </a>
                 </td>
             </tr>
             <!-- Title popup -->
            <div id="course_title_popup_<?php echo $course['id']?>" class="modal fade" style="display: none;"
                        tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                      <div class="modal-content">
                        <div class="modal-header">
                          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                          <h4 class="modal-title">Tiêu đề</h4>
                        </div>
                        <div class="modal-body">
                            <div id="message"></div>
                            <!-- label for="edit_en_title">EN</label>
                            <input type="text" id="edit_en_title" maxlength="125" readonly="readonly" value="<?php echo $course['titles']['en']['content']?>" style="width: 90%;"/-->
                            <label for="edit_vi_title">Tiếng anh</label>
                            <input type="text" id="edit_vi_title" maxlength="125" readonly="readonly" value="<?php echo $course['titles']['en']['content']?>" style="width: 90%;"/>
                        </div>
                        <div class="modal-footer">
                          <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
                        </div>
                      </div><!-- /.modal-content -->
                    </div><!-- /.modal-dialog -->
            </div>
             <?php endforeach;?>
        </tbody>
      </table>
      <?php echo $this->paginationcontrol2($this->page, $this->totalItem, $this->numRowPerPage, 'pagination.phtml', $this->currentUrl);?>
</div>
<?php } else {?>
<div>Không có khóa học nào!</div>
<?php }?>
